<?php

/*   __________________________________________________
    |  Obfuscated by YAK Pro - Php Obfuscator          |
    |              on 2018-07-17 15:20:03              |
    |    GitHub: https://github.com/pk-fr/yakpro-po    |
    |__________________________________________________|
*/
namespace MmqmMarket\controller\mobile;

defined("IN_IA") || die("Access Denied");
class MarketNearBy extends \MmqmMarket\controller\BaseController
{
    public function __construct($Site, $arguments)
    {
        parent::__construct($Site, $arguments);
        method_exists($this, $GLOBALS["_GPC"]["ac"]) && ($this->{$GLOBALS["_GPC"]["ac"]}() && die || die);
        include $this->template();
    }
    private function nearestFour()
    {
        \MmqmMarket\model\Util::createMySQLUserDefineDistanceFunction();
        $all = \MmqmMarket\model\SQL::all("\nSELECT *, `GETDISTANCE`(:lat, :lng, `A`.`lat`, `A`.`lng`) AS `Distance`\nFROM `@#__M_area` AS `A`\nWHERE 1 = 1\nORDER BY `Distance` ASC\nLIMIT 4\nOFFSET " . intval($GLOBALS["_GPC"]["exists"]), array(":lat" => $GLOBALS["_GPC"]["point"]["lat"], ":lng" => $GLOBALS["_GPC"]["point"]["lng"]));
        die(json_encode(array("market" => $all)));
    }
}